import 'package:flutter/material.dart';
import '..//common/ContactsInfo.dart';

class Contact extends StatefulWidget {
  Contact({Key key}) : super(key: key);

  @override
  _ContactState createState() => _ContactState();
}

class _ContactState extends State<Contact> {
  //显示用户详情
  showContactsInf() {
    showDialog(
        context: context,
        builder: (BuildContext context) {
          return SimpleDialog(
            // title: Text("SimpleDialog"),
            // titlePadding: EdgeInsets.all(10),
            // backgroundColor: Colors.amber,
            elevation: 5,
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(6))),
            children: [
              //第一行
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  // back
                  IconButton(
                    icon: Icon(Icons.navigate_before),
                    onPressed: () {
                      Navigator.of(context).pop();
                    },
                  ),
                  // more
                  IconButton(
                    icon: Icon(Icons.more_horiz),
                    onPressed: () {},
                  )
                ],
              ),
              //第二行
              Column(
                children: [
                  Row(mainAxisAlignment: MainAxisAlignment.start, children: [
                    SizedBox(
                      width: 30,
                    ),
                    Container(
                      height: 64,
                      width: 64,
                      child: CircleAvatar(
                        backgroundImage: NetworkImage(
                            'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1207533529,3946480795&fm=26&gp=0.jpg'),
                      ),
                    ),
                    SizedBox(
                      width: 15,
                    ),
                    Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            '欧阳吹雪',
                            style: TextStyle(
                                fontSize: 18, fontWeight: FontWeight.bold),
                          ),
                          Text(
                            '女 20 安徽合肥',
                            style: TextStyle(color: Colors.grey),
                          ),
                          Text(
                            '账号：12081283',
                            style: TextStyle(color: Colors.grey),
                          ),
                        ]),
                  ]),
                ],
              ),
              //第三行
              SizedBox(
                height: 10,
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Text('动态',
                      style:
                          TextStyle(fontSize: 14, fontWeight: FontWeight.bold)),
                  Container(
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.all(Radius.circular(15)),
                    ),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceAround,
                      children: [
                        SizedBox(
                          width: 25,
                        ),
                        Container(
                          // 动态的图片
                          height: 48,
                          width: 48,
                          decoration: BoxDecoration(
                              borderRadius:
                                  BorderRadius.all(Radius.circular(10)),
                              image: DecorationImage(
                                fit: BoxFit.cover,
                                image: NetworkImage(
                                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2920512057,3632510937&fm=26&gp=0.jpg'),
                              )),
                        ),
                        SizedBox(
                          width: 5,
                        ),
                        Container(
                          // 动态的图片
                          height: 48,
                          width: 48,
                          decoration: BoxDecoration(
                              borderRadius:
                                  BorderRadius.all(Radius.circular(10)),
                              image: DecorationImage(
                                fit: BoxFit.cover,
                                image: NetworkImage(
                                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2920512057,3632510937&fm=26&gp=0.jpg'),
                              )),
                        ),
                        SizedBox(
                          width: 5,
                        ),
                        Container(
                          // 动态的图片
                          height: 48,
                          width: 48,
                          decoration: BoxDecoration(
                              borderRadius:
                                  BorderRadius.all(Radius.circular(10)),
                              image: DecorationImage(
                                fit: BoxFit.cover,
                                image: NetworkImage(
                                    'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2920512057,3632510937&fm=26&gp=0.jpg'),
                              )),
                        ),
                      ],
                    ),
                  ),
                  //去空间
                  IconButton(
                    icon: Icon(Icons.navigate_next),
                    onPressed: () {
                      //去空间
                    },
                  ),
                ],
              ),
              //横线
              SizedBox(
                height: 30,
              ),
              Divider(),
              //发消息  视屏  语音
              SizedBox(height: 5),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceAround,
                crossAxisAlignment: CrossAxisAlignment.end,
                children: [
                  Column(
                    children: [
                      Container(
                          height: 48,
                          width: 48,
                          child: Image.asset(
                              "images/contact/drawable-xhdpi/contacts_btn_message.png")),
                      Text('发消息'),
                    ],
                  ),
                  Column(
                    children: [
                      Container(
                          height: 48,
                          width: 48,
                          child: Image.asset(
                              "images/contact/drawable-xhdpi/contacts_btn_dial_video.png")),
                      Text('发消息'),
                    ],
                  ),
                  Column(
                    children: [
                      Container(
                          height: 48,
                          width: 48,
                          child: Image.asset(
                              "images/contact/drawable-xhdpi/contacts_btn_dial_voice.png")),
                      Text('发消息'),
                    ],
                  ),
                ],
              )
            ],
          );
        });
  }

  @override
  Widget build(BuildContext context) {
    return Center(
        child: Container(
      width: 800,
      padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
      decoration: BoxDecoration(
          gradient: LinearGradient(
              //渐变位置
              begin: Alignment.topCenter, //右上
              end: Alignment.bottomCenter, //左下
              stops: [
            0.0,
            1.0
          ], //[渐变起始点, 渐变结束点]
              //渐变颜色[始点颜色, 结束颜色]
              colors: [
            Color.fromRGBO(243, 110, 71, 1),
            Color.fromRGBO(255, 255, 146, 1)
          ])),
      child: Column(
        children: [
          SizedBox(
            height: 50,
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Container(
                margin: EdgeInsets.fromLTRB(20, 0, 0, 0),
                child: Text(
                  '联系人',
                  textAlign: TextAlign.center,
                  style: TextStyle(
                      fontSize: 14,
                      fontWeight: FontWeight.bold,
                      color: Colors.white),
                ),
              ),
              Container(
                child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: [
                      Container(
                        height: 24,
                        width: 24,
                        margin: EdgeInsets.fromLTRB(5, 0, 5, 0),
                        child: Listener(
                          child: Image.asset(
                              "images/contact/drawable-xxhdpi/contacts_btn_qunzu.png"),
                          onPointerDown: (PointerDownEvent event) {},
                        ),
                      ),
                      Container(
                        height: 24,
                        width: 24,
                        margin: EdgeInsets.fromLTRB(5, 0, 5, 0),
                        child: Listener(
                          child: Image.asset(
                              "images/contact/drawable-xxhdpi/contacts_btn_kenengrenshideren.png"),
                          onPointerDown: (PointerDownEvent event) {},
                        ),
                      ),
                      Container(
                        height: 24,
                        width: 24,
                        margin: EdgeInsets.fromLTRB(5, 0, 25, 0),
                        child: Listener(
                          child: Image.asset(
                              "images/contact/drawable-xxhdpi/contacts_btn_jiahao.png"),
                          onPointerDown: (PointerDownEvent event) {
                            //跳转到添加联系人页面
                            Navigator.pushNamed(context, '/add_contacts');
                          },
                        ),
                      ),
                    ]),
              )
            ],
          ),
          Expanded(
              child: Container(
                  height: 200,
                  margin: EdgeInsets.fromLTRB(0, 20, 0, 0),
                  decoration: BoxDecoration(
                      color: Color.fromRGBO(249, 249, 249, 1),
                      borderRadius: BorderRadius.only(
                          topLeft: Radius.circular(25),
                          topRight: Radius.circular(25))),
                  child: Listener(
                    child: ListView(
                      padding: EdgeInsets.fromLTRB(10, 0, 10, 10),
                      children: [
                        Container(
                            height: 8,
                            child: IconButton(
                              icon: Icon(
                                Icons.arrow_drop_down,
                                color: Colors.grey,
                              ),
                              alignment: Alignment.center,
                              padding: EdgeInsets.all(0),
                              onPressed: () {
                                print(1);
                                setState(() {
                                  
                                });
                              },
                            )),
                        Container(
                            height: 40,
                            margin: EdgeInsets.fromLTRB(0, 15, 0, 0),
                            child: TextField(
                              textAlign: TextAlign.justify,
                              decoration: InputDecoration(
                                  hintText: "搜索",
                                  hintStyle: TextStyle(
                                    color: Colors.grey,
                                  ),
                                  contentPadding:
                                      EdgeInsets.fromLTRB(0, 5, 0, 0),
                                  prefixIcon: Icon(Icons.search),
                                  border: OutlineInputBorder(
                                      borderRadius: BorderRadius.circular(150)),
                                  labelText: '联系人昵称'),
                              onSubmitted: (value) {
                                print(value);
                              },
                              onTap: () {},
                            )),
                        //循环项
                        SizedBox(height: 10),
                        Listener(
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceAround,
                            children: [
                              Container(
                                height: 110,
                                width: 150,
                                decoration: BoxDecoration(
                                  borderRadius:
                                      BorderRadius.all(Radius.circular(10)),
                                  image: DecorationImage(
                                      image: AssetImage(
                                          'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                                ),
                                child: Column(
                                  children: [
                                    Container(
                                      height: 64,
                                      width: 64,
                                      child: CircleAvatar(
                                        backgroundImage: NetworkImage(
                                            "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                      ),
                                    ),
                                    SizedBox(
                                      height: 4,
                                    ),
                                    Text(
                                      '张三',
                                      style: TextStyle(
                                        fontWeight: FontWeight.bold,
                                        fontSize: 14,
                                      ),
                                    )
                                  ],
                                ),
                              ),
                              Container(
                                height: 110,
                                width: 150,
                                decoration: BoxDecoration(
                                  borderRadius:
                                      BorderRadius.all(Radius.circular(10)),
                                  image: DecorationImage(
                                      image: AssetImage(
                                          'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                                ),
                                child: Column(
                                  children: [
                                    Container(
                                      height: 64,
                                      width: 64,
                                      child: CircleAvatar(
                                        backgroundImage: NetworkImage(
                                            "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                      ),
                                    ),
                                    SizedBox(
                                      height: 4,
                                    ),
                                    Text(
                                      '张三',
                                      style: TextStyle(
                                        fontWeight: FontWeight.bold,
                                        fontSize: 14,
                                      ),
                                    )
                                  ],
                                ),
                              ),
                            ],
                          ),
                          onPointerDown: (PointerDownEvent e) {
                            //点开打开用户详情
                            this.showContactsInf();
                            // print(1);
                          },
                        ),
                        SizedBox(height: 10),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceAround,
                          children: [
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                          ],
                        ),
                        SizedBox(height: 10),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceAround,
                          children: [
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                          ],
                        ),
                        SizedBox(height: 10),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceAround,
                          children: [
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                          ],
                        ),
                        SizedBox(height: 10),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceAround,
                          children: [
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                          ],
                        ),
                        SizedBox(height: 10),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceAround,
                          children: [
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                          ],
                        ),
                        SizedBox(height: 10),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceAround,
                          children: [
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                            Container(
                              height: 110,
                              width: 150,
                              decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(10)),
                                image: DecorationImage(
                                    image: AssetImage(
                                        'images/contact/drawable-xxhdpi/contacts_bg_touxiang.png')),
                              ),
                              child: Column(
                                children: [
                                  Container(
                                    height: 64,
                                    width: 64,
                                    child: CircleAvatar(
                                      backgroundImage: NetworkImage(
                                          "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1587601794,489963968&fm=11&gp=0.jpg"),
                                    ),
                                  ),
                                  SizedBox(
                                    height: 4,
                                  ),
                                  Text(
                                    '张三',
                                    style: TextStyle(
                                      fontWeight: FontWeight.bold,
                                      fontSize: 14,
                                    ),
                                  )
                                ],
                              ),
                            ),
                          ],
                        ),
                      ],
                    ),
                    onPointerMove: (PointerMoveEvent event) {
                      setState(() {
                        //滑动效果
                      });
                    },
                  )))
        ],
      ),
    ));
  }
}
